jQuery(document).ready(function() 
{
	jQuery('input.numeric').numeric();
	jQuery('input.int').numeric();
	jQuery('input.tinyint').attr({ maxlength: "1" });
	jQuery('input.smallint').attr({ maxlength: "4" });
	jQuery('input.max_5000').attr({ maxlength: "5000" });
	jQuery('input.max_4000').attr({ maxlength: "4000" });
	jQuery('input.max_3500').attr({ maxlength: "3500" });
	jQuery('input.max_3000').attr({ maxlength: "3000" });
	jQuery('input.max_2500').attr({ maxlength: "2500" });
	jQuery('input.max_2000').attr({ maxlength: "2000" });
	jQuery('input.max_1500').attr({ maxlength: "1500" });
	jQuery('input.max_1400').attr({ maxlength: "1400" });
	jQuery('input.max_1200').attr({ maxlength: "1200" });
	jQuery('input.max_1000').attr({ maxlength: "1000" });
	jQuery('input.max_900').attr({ maxlength: "900" });
	jQuery('input.max_800').attr({ maxlength: "800" });
	jQuery('input.max_700').attr({ maxlength: "700" });
	jQuery('input.max_600').attr({ maxlength: "600" });
	jQuery('input.max_500').attr({ maxlength: "500" });
	jQuery('input.max_400').attr({ maxlength: "400" });
	jQuery('input.max_300').attr({ maxlength: "300" });
	jQuery('input.max_250').attr({ maxlength: "250" });
	jQuery('input.max_200').attr({ maxlength: "200" });
	jQuery('input.max_100').attr({ maxlength: "100" });
	jQuery('input.max_80').attr({ maxlength: "80" });
	jQuery('input.max_60').attr({ maxlength: "60" });
	jQuery('input.max_50').attr({ maxlength: "50" });
	jQuery('input.max_20').attr({ maxlength: "20" });
	jQuery('input.max_10').attr({ maxlength: "10" });
	jQuery('textarea.autogrow').autogrow(
	{
		minHeight: 30,
		lineHeight: 15
	});
	jQuery('textarea.limitLen').keyup(function(){
		var max = parseInt($(this).attr('maxlength'));
		if($(this).val().length > max){
			$(this).val($(this).val().substr(0, $(this).attr('maxlength')));
		}
	});
	jQuery('a.fancyBox').fancybox({
		 'overlayShow' : true,
		 'transitionIn' : 'elastic',
		 'transitionOut' : 'elastic'
	 });
	
	jQuery("a.fancyBoxGallery").fancybox({
		prevEffect : 'none',
		nextEffect : 'none',
		openEffect  : 'elastic',
		closeEffect : 'elastic',
		closeBtn  : true,
		arrows    : true,
		nextClick : true,
		helpers : {
					thumbs : 
					{
						width  : 50,
						height : 50
					},
					title : { type : 'over' },
					overlay	: 
					{
						opacity : 0.9,
						css : { 'background-color' : '#ccc' }
					}
				},
		afterLoad : function() { this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : ''); }
	});
	
	//jQuery('.accordion').accordion({ header: "h3", autoHeight: false  });
	jQuery('.tabs').tabs({cookie:{expires:1000}}); 
	
	jQuery('.button a, .jqUiButton').button();
	jQuery('.jqUiRadio').buttonset();
	jQuery('.jqUiButtonset').buttonset();

	jQuery(".date_pick_future").datepicker(
	{		
		minDate: 0,
		changeMonth: true,
		changeYear: true,
		dateFormat: 'dd.mm.yy'
	});
	jQuery(".modal-login").click(function() { $('#modalLoginForm').modal('show'); });
	jQuery(".modal-register").click(function() { $('#modalRegisterForm').modal('show'); });
	jQuery('.static-content:empty').remove();
});

jQuery(window).load(function() {
	var vZone = $(".thumbnails");
	vZone.each(function() 
	{ 
		var blocks =  $(this).find('.thumbnail .caption');
		tallest = 0;
		blocks.each(function() 
		{ 
			if($(this).height() > tallest) 
			{ tallest = $(this).height(); }
		});
		blocks.each(function() 
		{  $(this).height(tallest); });
	});
});
					 
function pageLoading()
{ $('#modalPageLoading').modal('show'); }